<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<ui:composition xmlns="http://www.w3.org/1999/xhtml" xmlns:s="http://jboss.com/products/seam/taglib"
	xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:f="http://java.sun.com/jsf/core"
	xmlns:h="http://java.sun.com/jsf/html" xmlns:r="http://richfaces.org/rich" xmlns:a="http://richfaces.org/a4j" 
	xmlns:ad="http://agiledev.com.br/fieldset">

	<ad:fieldset legenda="#{messages.associacao}" rendered="#{not empty sprintPlanMB.sprint and not empty sprintPlanMB.sprint.oid}">			
					
	<s:div>
		<s:div style="float: left; width: 61%">
			<r:listShuttle id="lsItemRelease" var="backlog" 
				sourceValue="#{fonte}" targetValue="#{alvo}" 
				sourceCaptionLabel="#{messages.releaseBacklog}"
				targetCaptionLabel="#{messages.sprintBacklog}"
				converter="itemReleaseConverter"
				fastOrderControlsVisible="false"
				orderControlsVisible="false"
				fastMoveControlsVisible="false"
				moveControlsVisible="false"
				sourceListWidth="350"
				targetListWidth="350"
				listsHeight="400" 
				targetSelection="#{alvoSelecionado}">

				<r:column width="200">
					<f:facet name="header">
						<h:outputText value="#{messages.nome}" />
					</f:facet>
					
					<h:outputText value="#{backlog.item.nome}" />
				</r:column>

				<r:column width="50">
					<f:facet name="header">
						<h:outputText value="#{messages.prioridade}" />
					</f:facet>
					
					<ui:include src="/pages/item/prioridade.xhtml">
						<ui:param name="valor" value="#{backlog.item.prioridade}" />
					</ui:include>
				</r:column>

				<r:column width="50">
					<f:facet name="header">
						<h:outputText value="#{messages.estimativa}" />
					</f:facet>
					
					<h:outputText value="#{backlog.item.estimativa}"/>
				</r:column>
				
				<a:queue name="qWhat" size="1" sizeExceededBehavior="dropNew"/>				
				<a:support event="onlistchanged" similarityGroupingId="sgiWhat" eventsQueue="qWhat" ajaxSingle="true" actionListener="#{sprintPlanMB.alterarAssociacao}" reRender="plEstimativa,fshow" oncomplete="hl();"/>
				<a:support event="onclick" similarityGroupingId="sgiWhat" requestDelay="500" eventsQueue="qWhat" ajaxSingle="true" actionListener="#{sprintPlanMB.selecionouItemWhat}" reRender="fsTarefa" oncomplete="hlTask();"/>
			</r:listShuttle>	
			
		</s:div>

		<s:div style="float: right; width: 39%; margin-top: 20px;">
		
			<ad:fieldset id="plEstimativa" legenda="#{messages.estimativa}">

				<r:effect name="hl" for="sprintPlanForm:plEstimativa_fieldset" type="Highlight" params="duration:0.8" />

				<s:decorate template="/layout/display.xhtml">
					<ui:define name="label">
						<h:outputText value="#{messages.total}" />
					</ui:define>
					
					<h:outputText value="#{sprintPlanMB.estimativaReleaseTotal}">
						<f:convertNumber maxFractionDigits="1"/>
					</h:outputText>					
				</s:decorate>

				<s:decorate template="/layout/display.xhtml">
					<ui:define name="label">
						<h:outputText value="#{messages.associado}" />
					</ui:define>
					
					<h:outputText value="#{sprintPlanMB.estimativaReleaseTotal - sprintPlanMB.estimativaReleaseNaoAssociado}">
						<f:convertNumber maxFractionDigits="1"/>
					</h:outputText>
				</s:decorate>
										
				<s:decorate template="/layout/display.xhtml">
					<ui:define name="label">
						<h:outputText value="#{messages.naoAssociado}" />
					</ui:define>
					
					<h:outputText value="#{sprintPlanMB.estimativaReleaseNaoAssociado}">
						<f:convertNumber maxFractionDigits="1"/>
					</h:outputText>					
				</s:decorate>

				<s:decorate template="/layout/display.xhtml">
					<ui:define name="label">
						<h:outputText value="#{messages.associadoSprint}" />
					</ui:define>
					
					<h:outputText value="#{sprintPlanMB.estimativaSprint}" styleClass="destaque">
						<f:convertNumber maxFractionDigits="1"/>
					</h:outputText>					
				</s:decorate>							
			</ad:fieldset>
		
			<ad:fieldset id="fsTarefa" legenda="#{messages.tasks}">
				
				<r:effect name="hlTask" for="sprintPlanForm:fsTarefa_fieldset" type="Highlight" params="duration:0.8" />
				
				<s:decorate	template="/layout/display.xhtml" rendered="#{not empty sprintPlanMB.task}">
					<ui:define name="label">
						<h:outputText value="#{messages.item}" />
					</ui:define>
					<h:outputText value="#{sprintPlanMB.task.item.nome}" />	
				</s:decorate>
				
				<a:commandLink action="#{sprintPlanMB.newTask(sprintPlanMB.task.item)}" ajaxSingle="true" title="#{messages.novo}" reRender="mpTask" data="#{eventContext.get('controle')}" oncomplete="if(data == 'sucesso'){Richfaces.showModalPanel('mpTask');}" rendered="#{not empty sprintPlanMB.task}">
					<h:graphicImage value="/img/note_add.png" />
				</a:commandLink>
				
				<r:dataTable id="dtTarefas" value="#{sprintPlanMB.task.item.tarefas}" var="task" width="100%" rows="7" rendered="#{not empty sprintPlanMB.task}">

					<f:facet name="footer">
						<r:datascroller for="dtTarefas"/>
					</f:facet>
				
					<r:column>
						<f:facet name="header">
							<h:outputText value="#{messages.nome}" />
						</f:facet>
						
						<h:outputText value="#{task.descricao}" />
					</r:column>
					
					<r:column styleClass="centro" width="10%">
						<f:facet name="header">
							<h:outputText value="#{messages.acoes}" />
						</f:facet>
					
						<a:commandLink action="#{sprintPlanMB.editTask(task)}" ajaxSingle="true" title="#{messages.editar}" reRender="mpTask" data="#{eventContext.get('controle')}" oncomplete="if(data == 'sucesso'){Richfaces.showModalPanel('mpTask');}">
							<h:graphicImage value="/img/note_edit.png" />
						</a:commandLink>
					</r:column>
				
				</r:dataTable>
				
				<h:outputText value="#{messages.selecioneItemParaEditar}" rendered="#{empty sprintPlanMB.task}"/>
						
			</ad:fieldset>
		
		</s:div>
	</s:div>				

</ad:fieldset> 

</ui:composition>